package spring.rabbitmq.workqueues;

import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * @author ZCW
 * @createTime 2018/4/29
 * @lastUpdateTime 2018/4/29 ZCW
 */
@Profile({"tutu2","workqueues"})
@Configuration
public class Config {

    public static final String WORKQUEUES = "workqueues";

    @Bean
    public Queue hello(){
        return new Queue(Config.WORKQUEUES);
    }

    @Profile("receiver")
    private static class ReceiverConfig {

        @Bean
        public Receiver receiver1() {
            return new Receiver(1);
        }

        @Bean
        public Receiver receiver2() {
            return new Receiver(2);
        }
    }

    @Profile("sender")
    @Bean
    public Producer sender(){
        return new Producer();
    }
}
